﻿@using TamoCRM.Core
@model TamoCRM.Web.Mvc.Areas.Admin.Models.Contacts.ContactCreateModel

@{
    ViewBag.Title = "Contact trùng cho TVTS";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed');
        }
        catch (e) {

        }
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="/Home">Trang chủ</a>
        </li>

        <li>
            <a href="javascript:void(0);">Danh mục</a>
        </li>
        <li class="active">Contact</li>
    </ul>
</div>

<div class="page-content">
    <div class="page-header">
        <h1>Contact trùng cho TVTS</h1>
    </div>
    <!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            @using (Ajax.BeginForm("FilterContactDuplicateConsultant", "Contact", new AjaxOptions { HttpMethod = "POST" }, new { enctype = "multipart/form-data", @class = "form-horizontal", role = "form", id = "filter_contact_duplicate_consultant" }))
            {
                @Html.AntiForgeryToken()
                <div class="form-group">
                    <div class="col-sm-12" id="alert">
                    </div>
                </div>
            }

            <div class="space-6"></div>
            <table id="grid-table"></table>
            <div id="grid-pager"></div>

            <!-- PAGE CONTENT ENDS -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</div>

<script type="text/javascript">
    var url = 'admin/api/contact/filterduplicatetvts?statusIds={0}&branchId={1}';
    var grid_selector = "#grid-table";
    var heades = ['Id', 'Họ và tên', 'Level', 'Email', 'Ngày', 'Sáng/Chiều', 'Giờ', 'Nội dung cuộc gọi gần nhất', 'Trạng thái chăm sóc', 'Tổng số cuộc gọi', 'Ngày bị trùng', 'Thông tin trùng'];
    var model = [
        { name: 'Id', index: 'Id', editable: false, sorttype: 'string', editoptions: { disabled: true }, width: '0px' },
        { name: 'Fullname', index: 'Fullname', editable: false, width: '90px', sorttype: 'string' },
        { name: 'LevelId', index: 'LevelId', editable: false, width: '40px', sorttype: 'string', align: 'center', formatter: levelFomatter },
        { name: 'Email', index: 'Email', editable: false, width: '70px', sorttype: 'string', align: 'center' },
        { name: 'AppointmentDate', index: 'AppointmentDate', editable: false, width: '60px', align: 'center', formatter: 'date', formatoptions: { srcformat: 'Y-m-dTH:i:s', newformat: 'd/m/Y' } },
        { name: 'AppointmentAmPm', index: 'AppointmentDate', editable: false, width: '70px', align: 'center', formatter: stringFormatter },
        { name: 'AppointmentTime', index: 'AppointmentDate', editable: false, width: '40px', align: 'center', formatter: 'date', formatoptions: { srcformat: 'Y-m-dTH:i:s', newformat: 'H:i' } },
        { name: 'CallInfo', index: 'CallInfo', editable: false, width: '200px', sorttype: 'string', align: 'left' },
        { name: 'StatusCareId', index: 'StatusCareId', editable: false, width: '100px', formatter: statusCareFomatter },
        { name: 'CallAmount', index: 'CallAmount', editable: false, width: '60px', align: 'center' },
        { name: 'CreatedDate', index: 'CreatedDate', editable: false, width: '80px', formatter: 'date', formatoptions: { newformat: 'd/m/Y' } },
        { name: 'DuplicateInfo', index: 'DuplicateInfo', editable: false, width: '80px', sorttype: 'string' }
    ];
    $(document).ready(function () {
        var statusIds = '@((int)StatusType.HandedoverToConsultant)';
        var branchId = '@ViewBag.BranchId';
        setupGridWithoutEdit("#grid-table", "#grid-pager", url.format(statusIds, branchId), "admin/api/contact/edit", "Id", "Danh sách Contact trùng", heades, model);
        
        $(grid_selector).jqGrid("setGroupHeaders", {
            useColSpanStyle: true,
            groupHeaders: [
                { startColumnName: "Fullname", numberOfColumns: 3, titleText: '<table style="width:100%;border-spacing:0px;"><tr><td style="text-align:center;height:40px;"><b>Thông tin Contact</b></td></tr></table>' },
                { startColumnName: "AppointmentDate", numberOfColumns: 3, titleText: '<table style="width:100%;border-spacing:0px;"><tr><td style="text-align:center;"><b>Thông tin lịch hẹn gọi lại</b></td></tr></table>' },
                { startColumnName: "CallInfo", numberOfColumns: 2, titleText: '<table style="width:100%;border-spacing:0px;"><tr><td style="text-align:center;"><b>Tình trạng chăm sóc</b></td></tr></table>' }
            ]
        });
    });
</script>
